import asyncio, asyncpg


async def main():
    connection = await asyncpg.connect(
        host="127.0.0.1",
        port="5432",
        database="products",
        user="around",
        password="zhouwei",
    )
    query = "select * from product"

    async with connection.transaction():
        async for row in connection.cursor(query):
            print(row)
    await connection.close()


asyncio.run(main())
